<?php
class IndexAction extends Action {

	function _initialize(){
		$this->setTitle( '首页 - 空间' );
	}	
	
	function index() {
		U('index/index/sitemap','',true);
		exit;
		$map['status'] = array('neq',3);
	
		//hot问题
		$_REQUEST['order'] = "worthCount";
		$hot = D('AskInfo','ask')->getAskList($map,7);

		//专家
		$expert = model('UserGroup')->getGroupUsers();
		if(!empty($expert)){
			$expert = array_slice($expert,0,6);
		}


		//最新问题
		$_REQUEST['order'] = "cTime";
		$map['status'] = 0;
		$new = D('AskInfo','ask')->getAskList($map,7);


		//获取Tag
		$tag = model("Xtag")->field('tagname as title,tagid')->order('weight DESC,tagid DESC')->limit("0,55")->findAll();
		$this->assign('tag',$tag);

		//获得关注的用户
		$follow = D('Follow')->field('count(1) as count,aimId')->where('`type`="user"')->order('count DESC')->group('aimId')->findAll();
		$follow = array_slice($follow,0,10);
		$this->assign('hotAsk',$hot);
		$this->assign('newAsk',$new);
		$this->assign('expert',$expert);
		$this->assign('followOrder',$follow);	

		//问答分类
		$cate = model('Xcate')->getTree("ask");
		$this->assign('cate',$cate);
		
		//韦心红增加 2010-02-09
		//系统公告
		$notice_system = D('Cms','home')->where('category=61')->field('id,title,category,url')->order('publish_time desc')->limit(6)->findAll();
		$this->assign('notice_system',$notice_system);	
		
		//空间动态
		$this->assign('feed',X('Feed')->get('display=0',10));
		
		//热门空间
		$this->assign('hotspace',D('Space')->field('visitnum,uid')->order('visitnum DESC')->limit(9)->findall());
		$this->setTitle('首页');	
		$this->display();
	}

	function getDesktopUrl() {
		include(SITE_PATH.'/addons/libs/Think/Http.class.php');
		$content	=	'[InternetShortcut]
URL='.SITE_URL.'
IDList=
IconFile=http://'.$_SERVER['HTTP_HOST'].__THEME__.'/images/favicon.ico
IconIndex=1
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2';
		//$file	=	THEME_PATH.'/hi3MS.url';
		$http	=	new Http;
		$http->download($file,'hi3MS.url',$content);
	}
}
?>